package com.byx.imserverutil.service;

import com.byx.imserverutil.listener.OnMessageReceivedListener;
import com.byx.imserverutil.protobuf.ChatMessageProtobuf;

/**
 * ImService
 * 即时通讯服务接口
 * @author Superb
 * @date 2021/2/9 12:48
 */
public interface ImService {
    /**
     * 初始化
     * @param port 端口号
     * @param onMessageReceivedListener 消息接收监听器
     * @return boolean
     */
    boolean initialize(int port, OnMessageReceivedListener onMessageReceivedListener);

    /**
     * 启动服务
     */
    void start();

    /**
     * 发送消息
     * @param msg 消息实体
     */
    void sendMessage(ChatMessageProtobuf.Msg msg);

    /**
     * 关闭服务，释放资源
     */
    void release();
}
